-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TS migration] Migrate withFullTransactionOrNotFound HOC #36855
[TS migration] Migrate withFullTransactionOrNotFound HOC #36855
Conversation
|
||
type WithFullTransactionOrNotFoundOnyxProps = { | ||
/** Indicated whether the report data is loading */ | ||
transaction: OnyxCollection<Transaction>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transaction: OnyxCollection<Transaction>; | |
transaction: OnyxEntry<Transaction>; |
export default function <TProps extends WithFullTransactionOrNotFoundProps, TRef>(WrappedComponent: ComponentType<TProps & RefAttributes<TRef>>) { | ||
// eslint-disable-next-line rulesdir/no-negated-variables | ||
function WithFullTransactionOrNotFound(props: TProps, ref: ForwardedRef<TRef>) { | ||
const transactionID = props.route.params.transactionID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const transactionID = props.route.params.transactionID; | |
const transactionID = props.transaction?.transactionID; |
Let's be cautious with these changes, before the file was getting from props
👀
key: ({route}) => { | ||
const transactionID = route.params.transactionID ?? 0; | ||
const userAction = route.params.action ?? CONST.IOU.ACTION.CREATE; | ||
return `${userAction === CONST.IOU.ACTION.CREATE ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return `${userAction === CONST.IOU.ACTION.CREATE ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`; | |
if (userAction === CONST.IOU.ACTION.CREATE) { | |
return `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}` as `${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`; | |
} | |
return `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`; |
Isn't pretty solution but I'm afraid we don't have other options
}, | ||
}, | ||
})(forwardRef(WithFullTransactionOrNotFound)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
export type {WithFullTransactionOrNotFoundProps}; |
Also, let's export the type (it will be used in the future)
Reviewer Checklist
Screenshots/VideosAndroid: NativeCleanShot.2024-02-28.at.23.41.25.mp4Android: mWeb ChromeCleanShot.2024-02-28.at.23.44.10.mp4iOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.-.2024-02-28.at.23.54.33.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.-.2024-02-28.at.23.56.10.mp4MacOS: Chrome / SafariCleanShot.2024-02-28.at.23.20.18.mp4MacOS: DesktopCleanShot.2024-02-28.at.23.52.27.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We did not find an internal engineer to review this PR, trying to assign a random engineer to #36123 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
🚀 Deployed to staging by https://github.com/tylerkaraszewski in version: 1.4.46-0 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.4.46-2 🚀
|
Hey @ruben-rebelo This PR was reverted, are you working on this, right? |
@fabioh8010 Yes, that is correct! |
Any updates @ruben-rebelo ? |
Just created an draft pr getting this back with the issue fixes, here is the PR: 38990 |
Details
[TS migration] Migrate *withFullTransactionOrNotFound HOC to TypeScript
Fixed Issues
$ #36123
PROPOSAL: N/A
Tests
Verify that no errors appear in the JS console
Open the app and log in
Navigate to any chat
Press plus and request money
Following the request money process should work as before
Offline tests
N/A
QA Steps
Same as in the Tests section.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
8mb.video-2W7-OcZXZfPw.mp4
Android: mWeb Chrome
android-web.mov
iOS: Native
ios-native.mov
iOS: mWeb Safari
ios-web.mov
MacOS: Chrome / Safari
macos-web.mov
MacOS: Desktop
macos-native.mov